<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>广告推送策略编辑</title>
<#include "/WEB-INF/content/module-edit.html">
<script type="text/javascript">
var isEnableValue=[
	{"id":"0","text":"不可用"},
	{"id":"1","text":"可用"}
];
var devType=[
	{"id":"android","text":"android"},
	{"id":"ios","text":"ios"},
	{"id":"other","text":"终端设备"}
];
$(function (){
	$("#isEnable").combobox({
  		valueField : 'id',
  		textField : 'text',
  		editable:true,
  		data:isEnableValue
  	});
	$("#devType").combobox({
  		valueField : 'id',
  		textField : 'text',
  		editable:true,
  		data:devType
  	});
	
	if($("#_id").val()!=""){
		var adids = '${object.adId!}';
		if(adids == null || adids.length == 0) return;
		var arrayS = adids.split(",");
		$('#adId').combobox('setValues', arrayS);
	}
})
function mySave(){
	 if (!$("#form").form('validate'))
		return; 
	 save();
}
</script>
<style>
.input-width{
	width: 95%;
}
</style>
 
</head>
<body class="easyui-layout">
	<div region="north" id="toolbar" style="background-color: #eee; padding: 5px; overflow: hidden;" border="false">
		<#if object.id?exists&&object.id!="">
			<@auth code="ad:strategy:update">
				<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-add" style="border: 1px solid #ccc" onclick="javascript:mySave()">保存</a>
			</@auth>
		<#else>
			<@auth code="ad:strategy:create">
				<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-add" style="border: 1px solid #ccc" onclick="javascript:mySave()">保存</a>
			</@auth>
		</#if>
		<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" iconCls="icon-edit" style="border: 1px solid #ccc" onclick="javascript:cancel()">关闭</a>
	</div>
	<div region="center">
		<div id="p" class="easyui-panel" style="background: #fafafa; padding: 10px" fit="true" toolbar="#toolbar">
			<form id="form" method="post">
				<table class="form" cellspacing="0" style="width: 100%">
					<tbody style="border: 1px solid #ccc">
						<tr style="display: none;">
							<td colspan="6"><input id="_id" name="id" value="${(object.id)!}"></td>
						</tr>
						<tr>
							<td class="label">广告名称：</td>
							<td>
								<input class="easyui-combobox" data-options=" valueField:'id',textField:'title',url:'${request.contextPath}/ad/info/getAdInfoList'"  id="adId" name="adId"  required="true" multiple="true"/>
							</td>
							<td class="validate">*</td>
							<td class="label">广告位：</td>
							<td><input class="easyui-combobox" data-options=" valueField:'id',textField:'posName',url:'${request.contextPath}/ad/pos/getAdPosInfoList'"  id="adPosId" name="adPosId" value="${(object.adPosId)!}" required="true"/></td>
							<td class="validate">*</td>	
						</tr>
						<tr>
							<td class="label">设备类型：</td>
							<td>
								<input id="devType" name="devType" required="true" value="${(object.devType)!'android'}"/>
							</td>
							<td class="validate">*</td>
							<td class="label">版本号：</td>
							<td><input id="ver" name="ver" class="easyui-validatebox" required="true"  value="${(object.ver)!}"/></td>
							<td class="validate">*</td>	
						</tr>
						<tr>
							<td class="label">开始投放时间：</td>
							<td>
								<input id="startTime" name="startTime" required="true" class="easyui-datebox" value="${(object.startTime)!}" editable="false"/>
							</td>
							<td class="validate">*</td>
							<td class="label">停止时间：</td>
							<td><input id="endTime" name="endTime" required="true" class="easyui-datebox" value="${(object.endTime)!}" editable="false"/></td>
							<td class="validate">*</td>	
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</body>
</html>